<div class="layui-form-item pt20 pl20 layui-form">
    <form class="layui-form"  action="{:url('mp/OutNodeProgress/confirmReturnGoods')}"   id="form33" >
        {foreach $list as $key=>$vo }
        <h2 class="layui-colla-title" style="clear: both;">订单{$vo.client_ordernum}，裁剪：{$vo.sum_shicai_count} 件</h2>
         <div class="layui-form-item" style="float: left;">
            <div class="layui-form-item">
                <label class="layui-form-label" >回货数</label>
                <div class="layui-input-inline"></div>
            </div>
             {foreach $vo.osList as $key2=>$vo2 }
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo2.size_name}</label>
                <div class="layui-input-inline">
                    <input type="text" name="return_goods_num[{$vo.client_ordernum}][{$vo2.mid}]" onchange="return_goods_num_edit(this,'{$vo.client_ordernum}',{$vo2.mid})" value="{$vo2.return_goods_num}" lay-verify="number|required" placeholder="输入数量" class="layui-input">
                </div>
                <label class="layui-form-label">裁床数：{$vo2.shicai_count}</label>
                <input type="hidden" name="shicai_count[{$vo.client_ordernum}][{$vo2.mid}]" value="{$vo2.shicai_count}">
            </div>
             {/foreach}
        </div>

        <div class="layui-form-item" style="float: left;clear: none;">
            <div class="layui-form-item">
                <label class="layui-form-label" >欠数</label>
                <div class="layui-input-inline"></div>
            </div>
            {foreach  $vo.osList as $key2=>$vo2 }
            <div class="layui-form-item">
                <label class="layui-form-label">{$vo2.size_name}</label>
                <div class="layui-input-inline">
                    <input type="text" name="owe[{$vo.client_ordernum}][{$vo2.mid}]" value="{$vo2.owe}" lay-verify="number|required" placeholder="输入数量" readonly class="layui-input">
                </div>
            </div>
            {/foreach}
        </div>


        <div class="layui-form-item" style="float: left;clear: none;">
            <label class="layui-form-label" >是否退料</label>
            <div class="layui-input-inline">
                <select name="sew_return_material_flag[{$vo.client_ordernum}]"  class="mimo-select group-id" style="width:80px;" lay-ignore="">
                    <option value="0" selected="">否</option>
                    <option value="1">是</option>
                </select>
            </div>
        </div>

        {/foreach}


        <div class="layui-inline fr" style="margin: 20px 20px;clear: both;">
            <button type="button" class="layui-btn layui-btn-normal" id="saveSewingform" style="background-color:#009688;">保存</button>
            <button type="button" class="layui-btn layui-btn-normal" id="submitSewingform">确定</button>
            <a href="javascript:parent.layui.layer.closeAll();" class="layui-btn layui-btn-primary ml10">取消</a>
        </div>
    </form>
</div>


{include file="system@block/layui" /}
<script src="__PUBLIC_JS__/jquery.2.1.4.min.js?v={:config('hisiphp.version')}"></script>
<script src="__PUBLIC_JS__/xm-select/dist/xm-select.js?v={:config('hisiphp.version')}"></script>
<script type="text/javascript">
    layui.use([ 'element', 'layer', 'laytpl', 'tool','laydate','table','form','flow'], function() {
        var element = layui.element;
        var layer = layui.layer;
        var $ = layui.jquery;
        var form = layui.form;
        var laytpl = layui.laytpl,laydate=layui.laydate ,table = layui.table;
        var flow = layui.flow;

        //确定提交回货表单
        $(document).on('click','#submitSewingform',function(e){
            e.stopPropagation();
            $.ajax({
                type: "POST",
                url: "{:url('mp/OutNodeProgress/confirmReturnGoods')}"+"?type_name=sewing",
                data: $('#form33').serialize() ,
                dataType:"json",
                success: function(res){
                    if (res.code == 1) {
                        window.parent.location.reload();
                        parent.layer.closeAll();
                    } else {
                        layer.msg(res.msg, {icon: 2,anim: 6});
                    }
                }
            });
            return false;
        });
        //确定保存回货表单
        $(document).on('click','#saveSewingform',function(e){
            e.stopPropagation();
            $.ajax({
                type: "POST",
                url: "{:url('mp/OutNodeProgress/confirmReturnGoods')}"+"?type_name=sewing_save",
                data: $('#form33').serialize() ,
                dataType:"json",
                success: function(res){
                    if (res.code == 1) {
                        window.parent.location.reload();
                        parent.layer.closeAll();
                    } else {
                        layer.msg(res.msg, {icon: 2,anim: 6});
                    }
                }
            });
            return false;
        });
    });

    function return_goods_num_edit(obj,client_ordernum,mid) {
        var shicai_count=parseInt($('[name="shicai_count['+client_ordernum+']['+mid+']"]').val());
        var return_goods_num=parseInt($('[name="return_goods_num['+client_ordernum+']['+mid+']"]').val());
        $('[name="owe['+client_ordernum+']['+mid+']"]').val(shicai_count-return_goods_num);
    }
</script>